<?php

namespace services;
use fast\Http;
class BwcService{
    const Appkey="2f89d520afba8195";
    const Appsecret="7b484ccf08b2a97d5a09d4bccb216158";
    const pid="yz-68197110-145818-170907";//推广位
    protected $url = null;
    protected $baseUrl = 'https://openapi.yunzhanxinxi.com/';


    public function __construct(){
      
    }


    /**
     * 商家列表
     * @param  [type]  $lat       [description]
     * @param  [type]  $lon       [description]
     * @param  integer $pagePvId  [description]
     * @param  string  $telephone [description]
     * @return [type]             [description]
     */
    public function merchantList($lat,$lon,$pagePvId='',$goodsType = 1,$telephone='')
    {
        $url = $this->baseUrl.'api/overlord-meal/merchant/list';
        $param = [
          'app_key' => self::Appkey,
          'timestamp' => time(),
          'lat' => $lat,
          'lon' => $lon,
          'telephone' => $telephone,
          'goodsType' => $goodsType, //商品类型(1:评价,2:订单,3:评价+订单)
          'sortType' => 1, //排序类型，不填为默认排序，0:默认排序,1:距离最近,2:佣金降序
        ];
        if ($pagePvId) {
          $param['pagePvId'] = $pagePvId;
        }
        $param['sign'] = $this->sign($param);
        return Http::post($url,$param,[]);
    }


    /**
     * 报名
     * @param  string $value [description]
     * @return [type]        [description]
     * {"status":true,"code":0,"msg":"SUCCESS","data":{"userEventId":"sn0YdKDxZr7rES79euaV7w==","platform_order_no":"BWC202308092038429639833"}}
     */
    public function registerevent($wmPoiId,$poiEventId,$meituanPvId,$telephone,$promotion_id,$notify_url,$goodsType)
    {
        $url = $this->baseUrl.'api/overlord-meal/merchant/registerevent';
        $param = [
          'app_key' => self::Appkey,
          'timestamp' => time(),
          'wmPoiId' => $wmPoiId,
          'poiEventId' => $poiEventId,
          'meituanPvId' => $meituanPvId,
          'telephone' => $telephone,
          'promotion_id' => $promotion_id,
          'notify_url' => $notify_url,
          'goodsType' => $goodsType,
        ];
        $param['sign'] = $this->sign($param);
        \think\Log::write('美团官方报名'.json_encode($param));
        // var_dump(json_encode($param),Http::post($url,$param,[]));exit;
        return Http::post($url,$param,[]);
    }


    /**
     * 取消报名
     * @param  string $value [description]
     * @return [type]        [description]
     * {"status":true,"code":0,"msg":"SUCCESS","data":{}}
     */
    public function cancelevent($userEventId)
    {
        $url = $this->baseUrl.'api/overlord-meal/merchant/cancelevent';
        $param = [
          'app_key' => self::Appkey,
          'timestamp' => time(),
          'userEventId' => $userEventId,
        ];
        $param['sign'] = $this->sign($param);
        return Http::post($url,$param,[]);
    }


    /**
     * 订单列表
     * @param  string $value [description]
     * @return [type]        [description]
     * {"status":true,"code":0,"msg":"SUCCESS","data":{"list":[{"platform_order_no":"BWC202308092038429639833","telephone":"15395101520","paid_amount":"0.00","paid_time":null,"paid_date":null,"order_profit":"0.00","userEventId":"sn0YdKDxZr7rES79euaV7w==","code":0,"goods":{"name":"买买提新疆羊肉串(凉城路店)","ratio":"4600","picture":"https:\/\/p1.meituan.net\/waimaipoi\/091a616eccf5317b4ae12ef75644fcde70352.jpg","skuList":[{"name":"羊肉串","skuId":"0sMpjw6dShdS5DFB4FG7rw%3D%3D","picUrl":"https:\/\/p0.meituan.net\/wmproduct\/fe838eebc780e93d43c75b598dcbc620951518.jpg","actPrice":"9.9","oriPrice":"9.9","actionUrl":{"dpUrl":"imeituan:\/\/www.meituan.com\/takeout\/foods?poi_id=1007308552954803&utm_content=95e0cc17-cb3f-45a4-8065-81321c1b982f--12319978--d536139d3cf34da4bf5c5d70f6327bf9&utm_medium=10011167&mt_selected_latitude=31.286538&mt_selected_longitude=121.470056&mt_ret_to=waimai_home&poi_id_str=vQpBFwNevCbBK4hnr6lEVwI&utm_term=d536139d3cf34da4bf5c5d70f6327bf9--95e0cc17-cb3f-45a4-8065-81321c1b982f--0&spu_id=5142613917","lpUrl":"https:\/\/h5.waimai.meituan.com\/waimai\/mindex\/menu?type=openh5_food&poiId=1007308552954803&poi_id_str=vQpBFwNevCbBK4hnr6lEVwI&mtShopId=1007308552954803&channel=ttadx&utm_source=60039&utm_medium=10011167&utm_content=95e0cc17-cb3f-45a4-8065-81321c1b982f--12319978--d536139d3cf34da4bf5c5d70f6327bf9&actualLat=31.286538&actualLng=121.470056®ion_id=1000110100®ion_version=1626089594604&isSetRouterProxyRequest=true&tt_sign=ltfevKAGJPvggu_5u4-8Z7afLRcish09AcTUFghFi3HIt58zSTsCjZTgSDRVcopu8I2O76KCJ4HTxRNMhX27PSrRJqCNNQbtDCUNlycOf4lurgyp55WxU0M0nCTepCxJs_-QkA8A02YuzruUnJ8wO6XB7ArBUQoFFRL7B6Wv04g&utm_term=d536139d3cf34da4bf5c5d70f6327bf9--95e0cc17-cb3f-45a4-8065-81321c1b982f--0"},"monthSaleNum":"2000+"},{"name":"羊里脊","skuId":"VRQWcAhoT21YDbix9TNcYA%3D%3D","picUrl":"https:\/\/p0.meituan.net\/wmproduct\/644653171089575c23f80667bfb8485e208592.jpg","actPrice":"15.0","oriPrice":"15.0","actionUrl":{"dpUrl":"imeituan:\/\/www.meituan.com\/takeout\/foods?poi_id=1007308552954803&utm_content=95e0cc17-cb3f-45a4-8065-81321c1b982f--12319978--d536139d3cf34da4bf5c5d70f6327bf9&utm_medium=10011167&mt_selected_latitude=31.286538&mt_selected_longitude=121.470056&mt_ret_to=waimai_home&poi_id_str=vQpBFwNevCbBK4hnr6lEVwI&utm_term=d536139d3cf34da4bf5c5d70f6327bf9--95e0cc17-cb3f-45a4-8065-81321c1b982f--0&spu_id=5142613922","lpUrl":"https:\/\/h5.waimai.meituan.com\/waimai\/mindex\/menu?type=openh5_food&poiId=1007308552954803&poi_id_str=vQpBFwNevCbBK4hnr6lEVwI&mtShopId=1007308552954803&channel=ttadx&utm_source=60039&utm_medium=10011167&utm_content=95e0cc17-cb3f-45a4-8065-81321c1b982f--12319978--d536139d3cf34da4bf5c5d70f6327bf9&actualLat=31.286538&actualLng=121.470056®ion_id=1000110100®ion_version=1626089594604&isSetRouterProxyRequest=true&tt_sign=ltfevKAGJPvggu_5u4-8Z7afLRcish09AcTUFghFi3HIt58zSTsCjZTgSDRVcopu8I2O76KCJ4HTxRNMhX27PSrRJqCNNQbtDCUNlycOf4lurgyp55WxU0M0nCTepCxJs_-QkA8A02YuzruUnJ8wO6XB7ArBUQoFFRL7B6Wv04g&utm_term=d536139d3cf34da4bf5c5d70f6327bf9--95e0cc17-cb3f-45a4-8065-81321c1b982f--0"},"monthSaleNum":"1000+"},{"name":"羊肝","skuId":"X%2F9Ta12LOFa1cz9FjNRn8Q%3D%3D","picUrl":"https:\/\/p1.meituan.net\/wmproduct\/ed516d89068be007a3e8a34df977d05a273005.jpg","actPrice":"8.0","oriPrice":"8.0","actionUrl":{"dpUrl":"imeituan:\/\/www.meituan.com\/takeout\/foods?poi_id=1007308552954803&utm_content=95e0cc17-cb3f-45a4-8065-81321c1b982f--12319978--d536139d3cf34da4bf5c5d70f6327bf9&utm_medium=10011167&mt_selected_latitude=31.286538&mt_selected_longitude=121.470056&mt_ret_to=waimai_home&poi_id_str=vQpBFwNevCbBK4hnr6lEVwI&utm_term=d536139d3cf34da4bf5c5d70f6327bf9--95e0cc17-cb3f-45a4-8065-81321c1b982f--0&spu_id=5142921237","lpUrl":"https:\/\/h5.waimai.meituan.com\/waimai\/mindex\/menu?type=openh5_food&poiId=1007308552954803&poi_id_str=vQpBFwNevCbBK4hnr6lEVwI&mtShopId=1007308552954803&channel=ttadx&utm_source=60039&utm_medium=10011167&utm_content=95e0cc17-cb3f-45a4-8065-81321c1b982f--12319978--d536139d3cf34da4bf5c5d70f6327bf9&actualLat=31.286538&actualLng=121.470056®ion_id=1000110100®ion_version=1626089594604&isSetRouterProxyRequest=true&tt_sign=ltfevKAGJPvggu_5u4-8Z7afLRcish09AcTUFghFi3HIt58zSTsCjZTgSDRVcopu8I2O76KCJ4HTxRNMhX27PSrRJqCNNQbtDCUNlycOf4lurgyp55WxU0M0nCTepCxJs_-QkA8A02YuzruUnJ8wO6XB7ArBUQoFFRL7B6Wv04g&utm_term=d536139d3cf34da4bf5c5d70f6327bf9--95e0cc17-cb3f-45a4-8065-81321c1b982f--0"},"monthSaleNum":"1000+"},{"name":"羊心","skuId":"FIjjAGbfMTGz4cSFep9zAQ%3D%3D","picUrl":"https:\/\/p0.meituan.net\/wmproduct\/443931aa401d692840b410ce06414d14208995.jpg","actPrice":"8.0","oriPrice":"8.0","actionUrl":{"dpUrl":"imeituan:\/\/www.meituan.com\/takeout\/foods?poi_id=1007308552954803&utm_content=95e0cc17-cb3f-45a4-8065-81321c1b982f--12319978--d536139d3cf34da4bf5c5d70f6327bf9&utm_medium=10011167&mt_selected_latitude=31.286538&mt_selected_longitude=121.470056&mt_ret_to=waimai_home&poi_id_str=vQpBFwNevCbBK4hnr6lEVwI&utm_term=d536139d3cf34da4bf5c5d70f6327bf9--95e0cc17-cb3f-45a4-8065-81321c1b982f--0&spu_id=5142763611","lpUrl":"https:\/\/h5.waimai.meituan.com\/waimai\/mindex\/menu?type=openh5_food&poiId=1007308552954803&poi_id_str=vQpBFwNevCbBK4hnr6lEVwI&mtShopId=1007308552954803&channel=ttadx&utm_source=60039&utm_medium=10011167&utm_content=95e0cc17-cb3f-45a4-8065-81321c1b982f--12319978--d536139d3cf34da4bf5c5d70f6327bf9&actualLat=31.286538&actualLng=121.470056®ion_id=1000110100®ion_version=1626089594604&isSetRouterProxyRequest=true&tt_sign=ltfevKAGJPvggu_5u4-8Z7afLRcish09AcTUFghFi3HIt58zSTsCjZTgSDRVcopu8I2O76KCJ4HTxRNMhX27PSrRJqCNNQbtDCUNlycOf4lurgyp55WxU0M0nCTepCxJs_-QkA8A02YuzruUnJ8wO6XB7ArBUQoFFRL7B6Wv04g&utm_term=d536139d3cf34da4bf5c5d70f6327bf9--95e0cc17-cb3f-45a4-8065-81321c1b982f--0"},"monthSaleNum":"1000+"},{"name":"羊肉串4串+烤包子1个+可乐1瓶","skuId":"vOAQMyx9dafQIBnBP4yNdQ%3D%3D","picUrl":"https:\/\/p0.meituan.net\/wmproduct\/722bbaf12d7cb182b617b6c2873679cb922806.jpg","actPrice":"48.0","oriPrice":"48.0","actionUrl":{"dpUrl":"imeituan:\/\/www.meituan.com\/takeout\/foods?poi_id=1007308552954803&utm_content=95e0cc17-cb3f-45a4-8065-81321c1b982f--12319978--d536139d3cf34da4bf5c5d70f6327bf9&utm_medium=10011167&mt_selected_latitude=31.286538&mt_selected_longitude=121.470056&mt_ret_to=waimai_home&poi_id_str=vQpBFwNevCbBK4hnr6lEVwI&utm_term=d536139d3cf34da4bf5c5d70f6327bf9--95e0cc17-cb3f-45a4-8065-81321c1b982f--0&spu_id=6291471338","lpUrl":"https:\/\/h5.waimai.meituan.com\/waimai\/mindex\/menu?type=openh5_food&poiId=1007308552954803&poi_id_str=vQpBFwNevCbBK4hnr6lEVwI&mtShopId=1007308552954803&channel=ttadx&utm_source=60039&utm_medium=10011167&utm_content=95e0cc17-cb3f-45a4-8065-81321c1b982f--12319978--d536139d3cf34da4bf5c5d70f6327bf9&actualLat=31.286538&actualLng=121.470056®ion_id=1000110100®ion_version=1626089594604&isSetRouterProxyRequest=true&tt_sign=ltfevKAGJPvggu_5u4-8Z7afLRcish09AcTUFghFi3HIt58zSTsCjZTgSDRVcopu8I2O76KCJ4HTxRNMhX27PSrRJqCNNQbtDCUNlycOf4lurgyp55WxU0M0nCTepCxJs_-QkA8A02YuzruUnJ8wO6XB7ArBUQoFFRL7B6Wv04g&utm_term=d536139d3cf34da4bf5c5d70f6327bf9--95e0cc17-cb3f-45a4-8065-81321c1b982f--0"},"monthSaleNum":"97"}],"wmPoiId":"a%2FRl2ViuWNkozLxYEouYAw%3D%3D","giftInfo":null,"platform":{"name":"美团","img_url":"https:\/\/img.yunzhanxinxi.com\/static\/personal\/bwc\/logo_ic@2x.png"},"actionUrl":{"dpUrl":"imeituan:\/\/www.meituan.com\/takeout\/foods?poi_id=1007308552954803&utm_content=95e0cc17-cb3f-45a4-8065-81321c1b982f--12319978--d536139d3cf34da4bf5c5d70f6327bf9&utm_medium=10011167&mt_selected_latitude=31.286538&mt_selected_longitude=121.470056&mt_ret_to=waimai_home&poi_id_str=vQpBFwNevCbBK4hnr6lEVwI&utm_term=d536139d3cf34da4bf5c5d70f6327bf9--95e0cc17-cb3f-45a4-8065-81321c1b982f--0","lpUrl":"https:\/\/h5.waimai.meituan.com\/waimai\/mindex\/menu?type=openh5_food&poiId=1007308552954803&poi_id_str=vQpBFwNevCbBK4hnr6lEVwI&mtShopId=1007308552954803&channel=ttadx&utm_source=60039&utm_medium=10011167&utm_content=95e0cc17-cb3f-45a4-8065-81321c1b982f--12319978--d536139d3cf34da4bf5c5d70f6327bf9&actualLat=31.286538&actualLng=121.470056®ion_id=1000110100®ion_version=1626089594604&isSetRouterProxyRequest=true&tt_sign=ltfevKAGJPvggu_5u4-8Z7afLRcish09AcTUFghFi3HIt58zSTsCjZTgSDRVcopu8I2O76KCJ4HTxRNMhX27PSrRJqCNNQbtDCUNlycOf4lurgyp55WxU0M0nCTepCxJs_-QkA8A02YuzruUnJ8wO6XB7ArBUQoFFRL7B6Wv04g&utm_term=d536139d3cf34da4bf5c5d70f6327bf9--95e0cc17-cb3f-45a4-8065-81321c1b982f--0","wxPath":"packages\/restaurant\/restaurant\/restaurant?poi_id=1007308552954803&poi_id_str=vQpBFwNevCbBK4hnr6lEVwI&utm_source=10011167&utm_medium=10011167&utm_content=95e0cc17-cb3f-45a4-8065-81321c1b982f--12319978--d536139d3cf34da4bf5c5d70f6327bf9","wxAppid":"wx2c348cf579062e56","wxAppOrgid":"gh_72a4eb2d4324","impMonitorUrl":"\/\/actadowm.meituan.com\/act\/ge\/g_monitor?monitor=QELCBDQ201s402i294eQ1BT7A4BLQM%2BoWHxUhjVLWtkIN2adOmXfGz4FdqaOav%2BVUq10ScMiVZOolSEAj%2BA6wDkjOqqjciCwyyyRDpkaujEpMP24FUbF%2FitaIwZjFhz0LkpvU%2BpDUGq9dDgss7Coj5ELdD1PE2N%2F7rWXyC8eQLb1iR8m3hfwvahyd%2BxjDyYzt7dXTge3czjn3I93yC4xW2YhWnmkyEJaSBiZfzZhKJ%2B%2B54fCBVdoFw4seob4I4q8QdO5DyRaIypW4H6zPmBkGpxLdq69MD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jFksxybPc0lrx4URg8UxuuzFncdxYYhNy%2BSST67Bf8etX3M3Dgx2xkmGVyTdS8mgFF%2BNT691nMcCnx83WA2N8Sowx6IjXLzqzVCsmBGY8VbM9j5BbOalolqgJURtbapho3HwfuIy6Wnf8oQ76uh7L36yqmeETqSwD3%2BJ1soUa7cQi8lXV9RQbFx%2BT24Ha3TOtyxKhZsi2NotB%2BrSeoQwK1Gv4VA511FtSBTxg087VKLydHvAqkVRrdayt87EKOKkEqFHlEQ4XQMlI7hsMEd3F%2FXdOV%2FOoiZ9UbvCsvcDvUiCVSLonuIXQ8OByjjEFHQa%2FnkQSgNC1gYjXjfzIPaPny5htPcdgvW2XdgDn8Z4MUCLQzOSjw89m6qoTTHCKsr%2B4E61EF3Guh4A8nsRGxd7YdN%2FGP%2FAmjrGcmi5A0devMAowHAAqF4KVhWcrPvcFdqqvotJcgZIOZB3QWHivDPR6crRomZ1odKOaEB%2FRKa8cm7ZoB8IBptNBLExn6yNmRdFoqG8wRT%2FFWpOoSBvbmTiTZ%2Bc9TtGoo0%2F8MTqQwi%2BosDECQqXexQoquEk1NZxyFFnDeZEXCBblB5yolHZEomDvdNkqpS%2FTATBEwvye2FlR4QFMifDgFh%2FpaOfE9hr4nrvtpOI7kdZBHJvIgQI9uQMAvajbELLqvxo6w%2BUi%2FCO7nTfNIUeN3GI7ks%2BZJ1XzCmUQq4paC3OW40100%2FaKg22rdyZviRe052pomrP0hokUmUfHL52NU1XveQxAen6MQzK5TgpPXn%2Fj%2Fdk1pAqFJVZKiJCc1P%2Bo1o5d5h4hnasQRlQ2IaDLDsjRbdWTENemlB"},"inventory":"1","poiEventId":175082355,"wmPoiScore":"5.0","coupon_text":"满20返9","meituanPvId":"95e0cc17-cb3f-45a4-8065-81321c1b982f","minPriceTip":"¥30","averagePrice":"38.00","deliveryType":null,"poiRankLabel":"虹口区烧烤复购榜第1名","maxCommission":"7200","shippingFeeTip":"免配送费","totalInventory":10,"deliveryTimeTip":"30分钟","monthSaleNumStr":"2000+","deliveryDistance":"1.5km"},"promotion_id":"yz-68197110-145818-170907","user_source":"","settle_time":null,"created_at":"2023-08-09 20:38:42","updated_at":"2023-08-09 20:38:42"}],"page":1,"pageSize":20,"total":1}}
     */
    public function orderList($platform_order_no,$query_type,$start_time,$end_time,$page)
    {
        $url = $this->baseUrl.'api/overlord-meal/order/list';
        $param = [
          'app_key' => self::Appkey,
          'timestamp' => time(),
          'platform_order_no' => $platform_order_no,
          // 'query_type' => $query_type,
          'start_time' => $start_time,
          'end_time' => $end_time,
          'page' => $page,
        ];
        $param['sign'] = $this->sign($param);
        return Http::post($url,$param,[]);
    }

    // 签名
    public function sign($param)
    {
        ksort($param);
        $newArr = [];
        foreach ($param as $key => $value) {
            $newArr[] = $key . '=' . (is_array($value) ? json_encode($value, JSON_UNESCAPED_UNICODE) : $value);
        }
        $md5str = implode('&', $newArr);
        $sign = md5(self::Appsecret.$md5str.self::Appsecret);
        return $sign;
    }

    /**
     * 综合活动
     * @return [type] [description]
     * {
    "status": true,
    "code": 200,
    "message": "success",
    "data": [
      {
      "shop_origin_id": "upe7npTZi2r%2FuqTgtqn4jw%3D%3D",
      "name": "马伍旺饮料厂（银泰百货店）",
      "logo": "https://p1.meituan.net/waimaipoi/7cc75c449acfd5fd502855dcacc0a3d0673932.png",
      "address": "",
      "distance": "距离248m",
      "platform": 1,
      "platform_name": "美团",
      "platform_logo": "https://img.yunzhanxinxi.com/static/personal/bwc/logo_ic@2x.png",
      "limit_buy_ch": "该店铺每天限抢1单",
      "source": 1,
      "action_url": {
      "mt_monitor": {
      "imp_monitor_url": "//actadowm.meituan.com/act/ge/g_monitor?monitor=QELCBDQ201s402i294eQ1BT7A4BLQM%2BoWHxUhjVLWtkIN2adOmXfGz4FdqaOav%2BVUq10ScMiVZOolSEAj%2BA6wDkjOqqjciCwyyyRDpkaujEpMP24FUbF%2FitaIwZjFhz0Y8gyDZZX1%2B32AH3ndYct7WLmEAsCKhfB9fIhpts29Zii2UyUHoQ%2By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xvKF3WYwreJtiKYnRUpW6WPvMGsZbYOHjJBB7tRBR1%2F9apAjFLd2lpbIkI%2BJxM1hjTUEjRyc7%2FIlBfWYy0Org6VWvHS5xQ4M4ikTHUDRklPGDw%2Bx0YnkR3VSRO4eO4KLcq0tLDWhFtBxITb%2Ff1jWROhHgszuzcUJzXcEND1Tfm%2F50rr7GMaKQyJfKNc5i2Su%2FfrS1CsGSCNpNNkkV84SGAbwfLZJulAsSFHC8foTqFYvpVIl0c0vJs6oakqElxlvUW2i5xZPfbgv0IdloZr2TS6q2H8STV2eLaGjlELks%2FACBuhfwrpg3%2FBCbMVkQ6PS7tj0lHLm%2Fvat8NgC6KCOQrLIawWNNh25tNVUdtrYWmoFZyIAhhWHAYJAO9OSrNHKyaQ7xSmSW22nbImQgKjoZiwGBNuFN%2B43ko0qKEVkvjNh%2BunCYXbtWLrsslJShVCY1YGKajW6V20CXkO4BFwNdOm2QD99P0AbAnMTzfpS8v7PVIPvDU2NFpa9q3sSXRPYS64ml97818EOH2R7hwCgkjmdB2f%2F07rZuDfCOOsuRC1IGS1WAuCz1dIRGqGhg7I6dBQy12SYv94CFQOCYfizHC9QZXFwhI3ZDjv7ZpfaEldn8sxfy2ba%2FUwo9LDaydB2L9UxQk3YWy%2BpbQsBIscfWZnf9IuTJSCMXAk2uQr0aBx6G2woIP3WY%2BAmX7wAl7RNBaul1rHo4dOyuXI2ChEmoek0pkqgsh7Sbm8oXo2C4FnVXNYMfy7PVqjG%2Bqjz6u38IQE3GJVmhotOdb4CXdlaT7%2FGn8vMtviBNr1NGky07Ph4pyWyJ8TTonM4DIztW4f2EExI8S1PMiCD5HEwVZo3H5AsMoNCpjv%2FyufXa6ao0E8Guuw0YpIxzW3z9l80ZHiSNOXwZ9v1be30DEQ%3D%3D"
      },
      "h5": {
      "mt": "https://h5.waimai.meituan.com/waimai/mindex/menu?type=openh5_food&poiId=933856038779628&poi_id_str=WBbI4HH47dYEpq5kJgR1GwI&mtShopId=933856038779628&channel=ttadx&utm_source=60039&utm_medium=10011167&utm_content=eddbd744-261c-4a35-9e94-7481c7fe5f2b--19462753--0089739d1a0c4747aec9819cf21a2869&actualLat=31.818569&actualLng=117.234491®ion_id=1000110100®ion_version=1626089594604&isSetRouterProxyRequest=true&tt_sign=LabyH4u8pgT1_NXTmWqR4yg9VNRZIh8E8WkT0F4ojwBAnS7rjL-pMdo7mNqpwoZHNCG3fIXCL02CC2lHw0AqKBp-meSu4thZ_zK1feJXh4YZA7TU2_v30DOqUTgFLoMYpYDxLrBvf3M6YHkp88fqj7ovUyvvixwWekqQ5dA5n4I&utm_term=0089739d1a0c4747aec9819cf21a2869--eddbd744-261c-4a35-9e94-7481c7fe5f2b--9"
      },
      "wx_mini": {
      "mt": {
      "path": "packages/restaurant/restaurant/restaurant?poi_id=933856038779628&poi_id_str=WBbI4HH47dYEpq5kJgR1GwI&utm_source=10011167&utm_medium=10011167&utm_content=eddbd744-261c-4a35-9e94-7481c7fe5f2b--19462753--0089739d1a0c4747aec9819cf21a2869",
      "appid": "wx2c348cf579062e56",
      "origin_id": "gh_72a4eb2d4324"
      }
      }
      },
      "plan_list": [
      {
      "plan_id": "1-upe7npTZi2r%2FuqTgtqn4jw%3D%3D_5070647304151855946",
      "plan_origin_id": "5070647304151855946",
      "plan_type": 2,
      "plan_type_ch": "无需评价",
      "plan_type_desc_ch": "必须与美团点餐账号绑定的手机一致",
      "server_time": 1713323971,
      "start_time": 1713283200,
      "end_time": 1713369599,
      "rest_stock": 6,
      "total_stock": 6,
      "commission_type": 2,
      "commission_type_ch": "按比例",
      "min_amount": 0,
      "commission": "15.52",
      "ratio": 23,
      "origin_ratio": "24",
      "origin_max_commission": "16"
      },
      {
      "plan_id": "1-upe7npTZi2r%2FuqTgtqn4jw%3D%3D_1836667016474278321",
      "plan_origin_id": "1836667016474278321",
      "plan_type": 1,
      "plan_type_ch": "需用餐评价",
      "plan_type_desc_ch": "用餐反馈（需含字含图）",
      "server_time": 1713323971,
      "start_time": 1713283200,
      "end_time": 1713369599,
      "rest_stock": 1,
      "total_stock": 4,
      "commission_type": 2,
      "commission_type_ch": "按比例",
      "min_amount": 0,
      "commission": "17.50",
      "ratio": 26,
      "origin_ratio": "27",
      "origin_max_commission": "18"
      }
      ],
      "distance_m": 248
      },
      ]
}
     */
    public function comprehensivePlayList($lat,$lon,$page=1,$plan_source=1,$able_join='',$only_order='',$platform='',$keywords='',$client_ip='')
    {
        $url = $this->baseUrl.'api/olm/open/plan/list';
        $biz = [
          'map_lat' => $lat,
          'map_lon' => $lon,
          'sort' => "asc", //排序类型，不填为默认排序，0:默认排序,1:距离最近,2:佣金降序
          'plan_source' => $plan_source,//不传默认为1，显示所有渠道 2.仅显示美团官方渠道, 3.仅显示饿了么官方渠
          "page"=> $page, //页码
          "platform" => $platform, //平台 1：美团 2饿了么 不传则表示获取所有平台
          "only_order"=> $only_order, //无需评价店铺，不选传空或不传查看所有店铺
          "able_join"=> $able_join, //只看有库存的店铺  不选传空或不传 看所有店铺
        ];
        if ($client_ip) {
          $biz['client_ip'] = $client_ip;
        }
        if ($keywords) {
          $biz['keyword'] = $keywords;
        }
        $param = [
          'app_key' => self::Appkey,
          'biz' => $biz,
        ];
        $param['sign'] = $this->sign($param);
        $params = json_encode($param);
        $header = array('Content-Type: application/json; charset=utf-8','Content-Length:' . strlen($params));
        return Http::post($url,$params,[],$header);
    }


    /**
     * 云瞻放单详情
     * @param  [type] $plan_id   [description]
     * @param  [type] $lat       [description]
     * @param  [type] $lon       [description]
     * @param  [type] $telephone [description]
     * @return [type]            [description]
     */
    public function comprehensivePlayInfo($plan_id,$lat,$lon,$telephone)
    {
        $url = $this->baseUrl.'api/olm/open/plan/info';
        $biz = [
          'plan_id' => $plan_id,
          'map_lat' => $lat,
          'map_lon' => $lon,
        ];
        if ($telephone) $biz['telephone']=$telephone;
        $param = [
          'app_key' => self::Appkey,
          'biz' => $biz,
        ];
        $param['sign'] = $this->sign($param);
        $params = json_encode($param);
        $header = array('Content-Type: application/json; charset=utf-8','Content-Length:' . strlen($params));
        return Http::post($url,$params,[],$header);
    }


    /**
     * 云瞻活动报名
     * @param  [type] $plan_id   [description]
     * @param  [type] $lat       [description]
     * @param  [type] $lon       [description]
     * @param  [type] $telephone [description]
     * @return [type]            [description]
     */
    public function apply($plan_id,$lat,$lon,$telephone='',$client_ip='')
    {
        $notify_url = config('domain').'/index/yunzhan/notify';
        $url = $this->baseUrl.'api/olm/open/plan/apply';
        $biz = [
          'plan_id' => $plan_id,
          'map_lat' => $lat,
          'map_lon' => $lon,
          'telephone' => $telephone,
          'notify_url' => $notify_url,
          'promotion_id' => self::pid,
        ];
        if ($client_ip) {
          $biz['client_ip'] = $client_ip;
        }
        $param = [
          'app_key' => self::Appkey,
          'biz' => $biz,
        ];
        $param['sign'] = $this->sign($param);
        $params = json_encode($param);
        $header = array('Content-Type: application/json; charset=utf-8','Content-Length:' . strlen($params));
        return Http::post($url,$params,[],$header);
    }


    /**
     * 云瞻活动取消报名
     * @param  [type] $order_sn   [description]
     * @param  [type] $telephone [description]
     * @return [type]            [description]
     */
    public function unApply($order_sn,$telephone)
    {
        $url = $this->baseUrl.'api/olm/open/plan/unApply';
        $biz = [
          'order_sn' => $order_sn,
          'telephone' => $telephone,
        ];
        $param = [
          'app_key' => self::Appkey,
          'biz' => $biz,
        ];
        $param['sign'] = $this->sign($param);
        $params = json_encode($param);
        $header = array('Content-Type: application/json; charset=utf-8','Content-Length:' . strlen($params));
        return Http::post($url,$params,[],$header);
    }


    /**
     * 云瞻三方店铺回填单号
     * @param  [type] $order_sn   [description]
     * @param  [type] $telephone [description]
     * @param  [type] $user_order_sn [第三方订单号]
     * @return [type]            [description]
     */
    public function confirmOrder($order_sn,$telephone,$user_order_sn,$paid_amount=1)
    {
        $url = $this->baseUrl.'api/olm/open/plan/confirm-order';
        $biz = [
          'order_sn' => $order_sn,
          'telephone' => $telephone,
          'user_order_sn' => $user_order_sn,
          // 'paid_amount' => $paid_amount
        ];
        $param = [
          'app_key' => self::Appkey,
          'biz' => $biz,
        ];
        $param['sign'] = $this->sign($param);
        $params = json_encode($param);
        $header = array('Content-Type: application/json; charset=utf-8','Content-Length:' . strlen($params));
        return Http::post($url,$params,[],$header);
    }


    /**
     * 云瞻三方店铺上传凭证
     * @param  [type] $order_sn   [description]
     * @param  [type] $telephone [description]
     * @param  [type] $screen_shots [凭证图片路径,多个图片用逗号分隔]
     * @return [type]            [description]
     */
    public function uploadCredential($order_sn,$telephone,$screen_shots,$paid_amount,$user_order_sn,$e_commission)
    {
        $url = $this->baseUrl.'api/olm/open/plan/upload-credential';
        $biz = [
          'order_sn' => $order_sn,
          'telephone' => $telephone,
          'screen_shots' => $screen_shots,
          'paid_amount' => $paid_amount,
          'user_order_sn' => $user_order_sn,
          'e_commission' => $e_commission,
        ];
        $param = [
          'app_key' => self::Appkey,
          'biz' => $biz,
        ];
        $param['sign'] = $this->sign($param);
        $params = json_encode($param, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
        $header = array('Content-Type: application/json; charset=utf-8','Content-Length:' . strlen($params));
        return Http::post($url,$params,[],$header);
    }


    /**
     * 云瞻订单列表
     * @param  integer $page       [description]
     * @param  integer $page_size  [description]
     * @param  integer $date_type  [查询时间维度 1=>创建时间 2 完成时间 3下单时间 4更新时间]
     * @param  string  $start_date [开始时间 精确到时分秒 最多不超过31天]
     * @param  string  $end_date   [结束时间 精确到时分秒]
     * @param  integer $state      [状态 1 已报名 2：审核中 3：已完成 4已驳回 5 已取消 6已过期]
     * @param  string  $telephone  [下单手机号]
     * @return [type]              [description]
     */
    public function getOrderList($page=1,$page_size=20,$date_type=1,$start_date='',$end_date='',$state=1,$telephone='')
    {
        $url = $this->baseUrl.'api/olm/open/plan/get-order-list';
        $biz = [
          'page' => $page,
          'page_size' => $page_size,
          'date_type' => $date_type,
          'start_date' => $start_date,
          'end_date' => $end_date,
          'state' => $state
        ];
        if ($telephone) $biz['telephone'] = $telephone;
        $param = [
          'app_key' => self::Appkey,
          'biz' => $biz,
        ];
        $param['sign'] = $this->sign($param);
        $params = json_encode($param);
        $header = array('Content-Type: application/json; charset=utf-8','Content-Length:' . strlen($params));
        return Http::post($url,$params,[],$header);
    }


    /**
     * 云瞻订单列表
     */
    public function getOrderInfo($telephone,$order_sn)
    {
        $url = $this->baseUrl.'api/olm/open/plan/get-order-info';
        $biz = [
          'order_sn' => $order_sn,
        ];
        if ($telephone) $biz['telephone'] = $telephone;
        $param = [
          'app_key' => self::Appkey,
          'biz' => $biz,
        ];
        $param['sign'] = $this->sign($param);
        $params = json_encode($param);
        $header = array('Content-Type: application/json; charset=utf-8','Content-Length:' . strlen($params));
        return Http::post($url,$params,[],$header);
    }


}
